<?php
/**
 * Created by PhpStorm.
 * User: fengzi
 * Date: 2019/5/29
 * Time: 17:18
 */

namespace app\vehicle\model;
use think\Model;

class Delivery extends Model
{
    public function getStatusAttr($value){
        $arr = array('投递中','待确认','投递成功','投递失败');
        return $arr[$value];
    }

    public function business(){
        return $this->hasOne('bus_business','id','business_id')->field('id,name,score');
    }

    public function busList(){
        return $this->hasMany('delivery_bus','delivery_id','id')->where('status','lt',2)->with(['bus','driver']);
    }
    public function price(){
        return $this->hasOne('order_price','order_id','order_id')->bind('order_price');
    }
}